SA-MP Forums Archive
Error - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Error (/showthread.php?tid=462807)



Error - Ananisiki - 08.09.2013

^^^^^^^^


Re: Error - Fierro - 08.09.2013

While it'd be a nice to see what line "KillerName" is on as well as indications of what lines each of the ones you've shown are, I've gathered a bit of what the problem is. For SelectRandomPlayer(), your (dual) issue is that you're creating a variable called random and using the function Random, but the fact is the function is called random and you should name the variable Random. By using Random, you're calling an unnamed function, and by trying to create a variable random, you're attempting to use an existing function as a new variable -- that's a no-no.

Your next issue is in regards to the variable randomplayer. Unfortunately, randomplayer is nested within the BonusPlayer() function and ergo can't be used outside of it; you'll need to move randomplayer out of the function allowing it to be 'globally' called upon.

Your next problem, occurring in both OnPlayerDeath and BonusPlayer(), revolves around the fact that you have not properly initialized a few strings (initialization is done either with empty brackets (variableName[]) if you're defining on the same line, or brackets with the length of the variable if you're going to define on a later name (variableName[128], for example)). The strings you haven't initialized are pname (in both OnPlayerDeath and BonusPlayer()), randomplayer (BonusPlayer()) and kname (in OnPlayerDeath).

Also, on the line where you use format in OnPlayerDeath, you're missing a comma between the third and fourth parameter:
Before:
Код:
format(str1, sizeof(str1),"* %s (%d) Has Killed Bonus Player %s (%d)."kname, killerid, pname, playerid);
After:
Код:
format(str1,sizeof(str1),"* %s (%d) Has Killed Bonus Player %s (%d).", kname, killerid, pname, playerid);
I didn't provide any code that would completely give this away, but hopefully I've pointed you in the right direction (rep if I did, ask questions if not). If you need any more help, of course, reply


Re: Error - Ananisiki - 08.09.2013

^^^^^^^^


Re: Error - Fierro - 08.09.2013

Quote:
Originally Posted by Ananisiki
Посмотреть сообщение
Getting this error

pawn Код:
error 035: argument type mismatch (argument 2)
on this line:

pawn Код:
format(str, sizeof(str),"* %s (%d) Has Been Selected As Bonus Player.", pname, randomplayer);
Have you properly initialized pname and randomplayer yet? I'm not sure if that will have any affect on the second argument's type, but if it hasn't been done, might wanna give that a try. If you have already, not sure. The parameters look right, and str is definitely a string.


Re: Error - Ananisiki - 08.09.2013

^^^^^^^^


Re: Error - Fierro - 08.09.2013

Quote:
Originally Posted by Ananisiki
Посмотреть сообщение
A bit what I have :

pawn Код:
public OnPlayerDeath(playerid, killerid, reason)
{
    new kName[128];
    new string[503];
    new pID;
    isDead[playerid] = 1;
    SetPlayerScore(playerid, GetPlayerScore(playerid) -1);
    SetPlayerScore(killerid, GetPlayerScore(killerid) +1);
    KillingSpree[killerid] ++;
    KillingSpree[playerid] = 0;
    if(IsPlayerConnected(killerid) && killerid != INVALID_PLAYER_ID)
    {
    new WeapName[32], Name[MAX_PLAYER_NAME], KillerName[MAX_PLAYER_NAME];
    GetWeaponName(reason, WeapName, sizeof(WeapName));
    GetPlayerName(playerid, Name, MAX_PLAYER_NAME);
    GetPlayerName(killerid, KillerName, MAX_PLAYER_NAME);
The issue here is you haven't created Name and KillerName. In regards to my/your last post, did you initialize and fix the problem, then?


Re: Error - Matnix - 08.09.2013

--' Really ? So, if I send a message with "Welcome to my server" and an another server had the same message that mean I copy his server ? LOL.