15.11.2009, 13:15
How can i make when (for example) i type /cardm that the commands /fix are disabled?
new CarFix = 0;
public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp("/cardm", cmdtext, true, 10) == 0)
{
CarFix = 1;
return 1;
}
if (strcmp("/fix", cmdtext, true, 10) == 0)
{
if (CarFix == 1) return SendClientMessage(playerid, color, "can't use that here");
//other code
}
return 0;
}
Originally Posted by dice7
pawn Код:
|
new IsInCarDM[MAX_PLAYERS];
public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp("/cardm", cmdtext, true, 10) == 0)
{
IsInCarDM[playerid] = 1;
return 1;
}
if (strcmp("/fix", cmdtext, true, 10) == 0)
{
if (IsInCarDM[playerid] == 1) return SendClientMessage(playerid, color, "can't use that here");
//other code
}
return 0;
}
public OnPlayerDeath(playerid, killerid, reason)
{
if(IsInCarDM[playerid] == 1) SendClientMessage(playerid, color, "player was in car dm");
return 1;
}
public OnPlayerConnect(playerid)
{
OnPlayerCommandText(playerid, "/commands"); //will simulate that the player typed /commands
OnPlayerText(playerid, "hello"); //will simulate that the player typed hello (im not sure if the text is displayed in chat)
OnPlayerPickUpPickup(playerid, 3); //will tell the script that the player pickup a pickup with the id 3 (of course the player didn't)
return 1;
public OnPlayerText(playerid, text[]) { new Name[24]; GetPlayerName(playerid,Name,24); format(file,256,userfiles,Name); ClanName = dini_Get(file,"Clan"); if(text[0] == '!') { if(InMuteC[playerid] == 1){ SendClientMessage(playerid,COLOR_RED," אתה לא יכול לכתוב בקלאן צ'אט כשאתה במיוט ");return 0;} format(file,256,clansfiles,ClanName); if(dini_Int(file,"ChatLock") == 1) { format(file,256,userfiles,Name); if(dini_Int(file,"ClanLevel") < 3) { SendClientMessage(playerid,COLOR_RED," אתה לא יכול לכתוב בקלאן צ'אט כשהצ'אט נעול "); return 0; } } GetPlayerName(playerid,name,24); format(file,256,userfiles,name); if(dini_Isset(file,"Clan")) { format(str3,sizeof(str3)," [ClanChat] [%s] %s: %s (ID: %d | Level: %d) ",dini_Get(file,"Clan"),name,text[1],playerid,dini_Int(file,"ClanLevel")); SendClanMessage(); SendClanMessageToRadmin(); return 0; } } return 1; }
Originally Posted by [ĦŁ₣
ЉǾǖŦĦЗŁΛẄ ]
yes, it's called, not surprisingly, 'OnPlayerText' params: playerid - player who typed text text[] - text they entered |
Originally Posted by dice7
Every public function can be called script wise, since they're only functions and nothing else
Examples: pawn Code:
|
Originally Posted by russooooo
Quote:
|
if GetPlayerScore(playerid <100) return SetPlayerScore(playerid, 750);
error 001: expected token: "*then", but found "return"
Originally Posted by DevilRP
Code:
if GetPlayerScore(playerid <100) return SetPlayerScore(playerid, 750); Code:
error 001: expected token: "*then", but found "return" |
Originally Posted by sansko
Hey all,
I want to have an aircraftcarrier in front of santa maria beach the onley thing that i need is the carrier with doors etc. And if it could an move object cmd for the 2 plane lifts (entrance door isnt neccery) Thanks in advance Sansko |
Originally Posted by [ĦŁ₣
ЉǾǖŦĦЗŁΛẄ ]
",nameoflol,cmdtext[4]); I think that is only inserting the fifth character, rather than all the text that's after the fifth character. 256 is too big, use 128 then minus whatever text you put in with the message: "** Car Chat ** %s: %s" I count 42 characters, so should be: new str[(128-42)]; I never use this method of parameter commands, I would advise using DCMD and sscanf, that is the easiest. :P |
Originally Posted by O_x
Quote:
Well at least I've tried.. D: |
Originally Posted by mamoru
Quote:
While reading through it all: It does work, it will also send to the others in the car but, as mentioned, it can be more efficient on your memory and/or server load. |