Hello There, Guest! Login or Register


[Solved] See the other player's weapons (Only tested on my own)
#1
Hey all, I had some errors with undefined symbol tmp ReturnUser etc etc, This is fixed now but then I get different errors which pisses me off.
I have this:

On top of script under forwards:
Code:
new cmd[128];
new tmp[128];
new giveplayername[MAX_PLAYER_NAME];
new sendername[MAX_PLAYER_NAME];
new ReturnUser;
new string[128];

I did this to define them.

Under the command:
Code:
if(strcmp(cmd, "/pweapons", true) == 0) {
if(!strlen(tmp))
{
SendClientMessage(playerid, orange, "USAGE: /pweapons [playerid/name]");
return 1;
}
new giveplayerid = ReturnUser(tmp);
if(giveplayerid != INVALID_PLAYER_ID)
{
new bullets[12];
new weapons[12];
new weapname[12][20];
for(new i = 0; i < 12; i++)
{
GetPlayerWeaponData(giveplayerid, i+1, weapons[i], bullets[i]);
GetWeaponName(weapons[i], weapname[i], 20);
}
GetPlayerName(giveplayerid, giveplayername, sizeof(giveplayername));
format(string,sizeof(string),"        |-        %s's Weapons        -|",giveplayername);
SendClientMessage(playerid,red,string);
format(string, sizeof(string),"%s(0) - %s(%d) - %s(%d) - %s(%d) - %s(%d) - %s(%d)",weapname[0],weapname[1],bullets[1],weapname[2],bullets[2],weapname[3],bullets[3],weapname[4],bullets[4],weapname[5],bullets[5]);
SendClientMessage(playerid,white,string);
format(string,sizeof(string),"%s(%d) - %s(%d) - %s(%d) - %s(0) - %s(0) - %s(0)",weapname[6],bullets[6],weapname[7],bullets[7],weapname[8],bullets[8],weapname[9],weapname[10],weapname[11]);
SendClientMessage(playerid,white,string);
return 1;
}

The errors + a warning that needs to be fixed:
Code:
C:\Users\Nel\Desktop\Mijn spullen\GTA Games\Server test gta\filterscripts\Test.pwn(178) : error 012: invalid function call, not a valid address
C:\Users\Nel\Desktop\Mijn spullen\GTA Games\Server test gta\filterscripts\Test.pwn(178) : warning 215: expression has no effect
C:\Users\Nel\Desktop\Mijn spullen\GTA Games\Server test gta\filterscripts\Test.pwn(178) : error 001: expected token: ";", but found ")"
C:\Users\Nel\Desktop\Mijn spullen\GTA Games\Server test gta\filterscripts\Test.pwn(178) : error 029: invalid expression, assumed zero
C:\Users\Nel\Desktop\Mijn spullen\GTA Games\Server test gta\filterscripts\Test.pwn(178) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664              Copyright (c) 1997-2006, ITB CompuPhase


4 Errors.

I have to be sure 100% is correct because I'm scripting for a server. I only have my own script I started with. I have like 4 backups (lol) In case I don't get some shit fixed.

Can anybody help me out?
I hope I get an answer soon.

Kind Regards
- speedruntrainer

EDIT: Line 178 is:
PAWN Code:

new giveplayerid = ReturnUser(tmp);
Reply
#2
You probably don't have returnuser(tmp) as function. strcmp sucks though, use dcmd + sscanf
Reply
#3
Where I need to add that function exactly?

And what is dcmd and sscanf? It will take YEARS to script if I use dcmd because I did everything with strcmp. :( Everything is failing on me when it's getting harder.
Reply
#4
Yeah but dcmd & sscanf is just way better. Try making a /giveweapon [id] [weaponid] [ammo] command with strcmp ;).

EDIT: Looks like somebody gave you the function in your other topic @ the SA:MP forums already ;)
Reply
#5
Mijn spullen!
Reply
#6
Oh yeah, I called a folder like this So I know almost all my things are in there.
I made that folder mainly because my desktop was full so all my things are in that folder now :+

I also installed GTA San Andreas and sa-mp in there lol.
Reply
#7
Solved, but tested it on my own server only.
Couldn't test it with other players yet.
Reply