How to define "senderid"? -
jessejanssen - 17.02.2012
Hello reader,
If you read any post I did before you already know I am new to pawn, but I want to learn! Now I was trying to create a "PM" system in game so that a player can type "/pm [ID]" and that it will send a message to another player. Now I would like not to get all fixed codes posted since I really want to script something myself, but I just want to know how to define "senderid" because I keep getting these errors:
Код:
C:\Users\Administrator\Desktop\samp03dsvr_R2_win32\gamemodes\test2.pwn(330) : error 035: argument type mismatch (argument 1)
C:\Users\Administrator\Desktop\samp03dsvr_R2_win32\gamemodes\test2.pwn(330) : error 035: argument type mismatch (argument 1)
C:\Users\Administrator\Desktop\samp03dsvr_R2_win32\gamemodes\test2.pwn(331) : error 017: undefined symbol "senderid"
C:\Users\Administrator\Desktop\samp03dsvr_R2_win32\gamemodes\test2.pwn(329) : warning 203: symbol is never used: "pmontvang"
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase
3 Errors.
I know I can fix 3 of the 4 errors/warnings but I first need to know how to define "senderid".
This is the code I made ( Yes, I started using ZCMD after some people told me it was easier/better. ):
pawn Код:
CMD:pm(playerid, params[])
{
new pmverstuur[128];
format(pmverstuur, sizeof(pmverstuur), "(( PM to: [ %d ]: %s ))", playerid, params);
SendClientMessage(playerid, KLEUR_PM, pmverstuur);
new pmontvang;
format(pmontvang, sizeof(pmontvang), "(( PM from: [ %d }: %s ))", senderid, params);
SendPlayerMessageToPlayer(playerid, senderid, pmontvang);
return 1;
}
I hope someone can help me out with this, I'd really appreciate it!
Best regards,
Jesse
Re: How to define "senderid"? -
Abreezy - 17.02.2012
new senderid;
That simple
Re: How to define "senderid"? -
jessejanssen - 17.02.2012
Quote:
Originally Posted by Abreezy
new senderid;
That simple
|
Lol, thanks :P. And the other errors where simply caused because I did:
instead of:
xD. So yea, that was kind of bad from me but you learn from your mistakes ^^!
Jesse
Re: How to define "senderid"? -
Abreezy - 17.02.2012
If you want, use sscanf aswell for the pm command for example:
pawn Код:
CMD:pm(playerid, params[])
{
new pID, pmsg[128], string[128];
if(sscanf(params("us[128]", pID,pmsg)) return SendClientMessage(playerid, -1, "You must put playerid and message, /pm playerid message");
format(string, sizeof(string), "[FROM %i] : %s", playerid, pmsg);
SendClientMessage(pID, -1, string);
format(string, sizeof(string), "[TO %i] : %s", pID, pmsg);
SendClientMessage(playerid, -1, string);
return 1;
}
This is roughly made, and untest, I made it in the quick reply box.
Re: How to define "senderid"? -
jessejanssen - 17.02.2012
Quote:
Originally Posted by Abreezy
If you want, use sscanf aswell for the pm command for example:
pawn Код:
CMD:pm(playerid, params[]) { new pID, pmsg[128], string[128]; if(sscanf(params("us[128]", pID,pmsg)) return SendClientMessage(playerid, -1, "You must put playerid and message, /pm playerid message"); format(string, sizeof(string), "[FROM %i] : %s", playerid, pmsg); SendClientMessage(pID, -1, string); format(string, sizeof(string), "[TO %i] : %s", pID, pmsg); SendClientMessage(playerid, -1, string); return 1; }
This is roughly made, and untest, I made it in the quick reply box.
|
I already got myself a code, thank you anyways :P. But I will create a new topic with the next problem I have :O.
Best regards,
Jesse
EDIT:
Nevermind, I already fixed the problem for the biggest part. Someone I know can help me with the small part what's left :P